{extend name="public:base" /}
{block name="theme"}业务管理{/block}
{block name="small_theme"}编辑订单{/block}
{block name="breadcrumb"}
<li><a href="{:url('olist')}">业务列表</a></li>
<li class="active">业务首页</li>
{/block}
{block name="content"}
<style>
    input.error { border: 1px solid red; }
    label.error {
        font-weight: bold;
        color: #EA5200;
    }
</style>
<link rel="stylesheet" href="__CSS__/style.css">
<link rel="stylesheet" href="__CSS__/addcomon.css">
<div class="row" style="padding:15px;">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header" data-original-title="" style="height: 40px;">
                <h2>编辑转介绍订单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID:{$info.id}</h2>
            </div>
            <form id="commentForm" method="post" action="{:url('edit')}" >
                <div class="add-box">
                    <div class="box-left">
                        <input type="hidden" name="id" value="{$info.id}" id="id">
                        <label>顾客信息：</label>
                        <div class="form-group add-form-group">
                            <label>顾客姓名</label>
                            <input type="text" name="name" value="{$info.name}">
                        </div>
                        <div class="form-group add-form-group">
                            <label>妈妈电话</label>
                            <input type="text" name="maphone" value="{$info.tel}"  disabled>
                        </div>
                        <div class="form-group add-form-group">
                            <label>转介绍人</label>
                            <input type="text" name="" value="{$user.username}" disabled>
                        </div>
                        <div class="form-group add-form-group">
                            <label>转介绍人电话</label>
                            <input type="text" name="" value="{$user.mobile}" disabled>
                        </div>
                        <div class="add-form-group">
                            <label>备注</label>
                            <textarea type="text" rows="5" name="bz" >{$info.bz}</textarea>
                        </div>
                    </div>

                    <div class="btn-box">
                        <button type="submit" class="btn btn-color-o" id="submit">提交</button>
                        <button type="button" class="btn btn-color-g" onclick="javascript:history.back(-1);return false;">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}

{block name="js"}
<!--<script type="text/javascript" src="__JS__/moment.js"></script>-->
<script type="text/javascript" src="__STATIC__/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="__STATIC__/validate/jquery.metadata.js"></script>
<!--<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>-->
<!--<script type="text/javascript" src="__JS__/yewu.js"></script>-->
<!--<script type="text/javascript" src="__JS__/chachong.js"></script>-->

<!--<script type="text/javascript">-->
    <!--function jumpurl() {-->
        <!--var p = {$p};-->
        <!--if( p == 0 ){-->
            <!--window.location.href = "{:url('olist',['editid'=>$info.id])}";-->
        <!--}else{-->
            <!--window.location.href = "{:url('olist',['editid'=>$info.id,'p'=>$p])}";-->
        <!--}-->
    <!--}-->
<!--</script>-->

<script type="text/javascript">
    $().ready(function() {
        // 在键盘按下并释放及提交后验证提交表单
        $("#commentForm").validate({

//            rules: {
//                name:      { required : true},
//                maphone:   { required : true,isMobile : true},
//                otherphone:{ isMobile : true},
//                ywstate:   { required : true}
//            },
//            messages: {
//                name: 		"请输入顾客姓名!",
//                maphone: 	{ required:"请输入妈妈电话！", isMobile:"请输入正确手机号码！" },
//                otherphone:	"请输入正确手机号码！",
//                ywstate:	"请选择状态！"
//            },

            submitHandler: function(form)
            {
                $.ajax({
                    type: "POST",
                    url:  "{:url('editOrders')}",
                    data: $(form).serialize(),
                    beforeSend:function(){
                        //alert(data);
                        // $(".alert-success").css({'display':'block'});
                        $('#submit').attr("disabled","false"); //禁止点击
                        layer.msg('提交中', {icon: 16,shade: 0.01,time:5000});
                    },
                    success: function(msg){
                        //console.log(msg);

                        if(msg.status == 1){
                            $('#submit').attr("disabled","false"); //禁止点击
                            layer.msg(msg.msg, {icon: 1});
                            setTimeout(function(){
                                location.href=msg.url;
                            },3000); //延迟演示
                        }else{
                            layer.msg(msg.msg, {icon: 5});
                            $('#submit').removeAttr("disabled"); //禁止点击
                        }
                    }
                });
            }

        });
        return false;
    });
    highlight_subnav("{:url('index')}");
</script>
{/block}